<script>
function p() {
	var xS=0,yS=0,wW=0,wH=0,pW=0,pH=0;
	try{
		var wih=window.innerHeight,dbw=document.body.scrollWidth,dbh=document.body.scrollHeight,wcy=window.scrollMaxY,dbsh=document.body.offsetHeight,ddch=document.documentElement.clientHeight;
		if(wih && wcy){xS=dbw;yS=wih+wcy;}
		else if(dbh>dbsh){xS=dbw;yS=dbh;}
		else {xS=document.body.offsetWidth;yS=dbsh;}
		if(wih){wW=window.innerWidth;wH=wih;}
		else if(document.documentElement && ddch){wW=document.documentElement.clientWidth;wH=ddch;}
		else if(document.body){wW=document.body.clientWidth;wH=document.body.clientHeight;}
		pH=(yS<wH)?wH:yS;
		pW=(xS<wW)?wW:xS;}
		catch(_e){}return {'pW':pW,'pH':pH,'wW':wW, 'wH':wH};
}
</script>
<body>
<p>AAAAAAAAAAA</p>
<script>
var size = p();
alert(size.pW + " " + size.pH + " " + size.wW+" " + size.wH);
</script>
</body>